%generate the variable vector for firing the CM4
path(path,'c:\manoj\geomag\mf\cm4\');
r = 6371.2 + 105; %105km is height to ionosphere
Dst = -50;
f107 = 180;
%mjd = 1:364;
mjd=79;
%theta = 90-8.08; %8.0875 is the geomagnetic dip-equator near India
phi = 80;
theta = [0:180];
theta1=theta;

mjd=mjd+(10.5-5.3333)/24;

options.n_min = [ 1 14]; % n_min
options.n_max = [13 45]; % n_max
options.cord = 1;     % geocentric coordinates
options.pred = [1 1 1 1 0 0];
options.filename =  'c:\manoj\geomag\mf\cm4\umdl.CM4';


pp = 1
for i = 1:length(theta),
   %   theta1(pp) = theta;
   mjd1(pp) = mjd;
      phi1(pp) = phi;
      Dst1(pp) = Dst;
      F1071(pp) = f107;
      r1(pp) = r;
      pp = pp+1;
end;

[B_x, B_y, B_z, J_x, J_y] = cm4(mjd1, r1, theta1, phi, Dst1, F1071, options);
